#include "ExplosionsManager.h"

ExplosionsManager* ExplosionsManager::mInstance = NULL;

ExplosionsManager::ExplosionsManager()
{

}

ExplosionsManager* ExplosionsManager::Instance()
{
	if(mInstance == NULL)
	{
		mInstance = new ExplosionsManager();
	}
	return mInstance;
}

ExplosionsManager::ExplosionsManager(const ExplosionsManager&)
{

}

ExplosionsManager::~ExplosionsManager()
{

}


void ExplosionsManager::Initialize()
{
	mNextIndexExplosion = 0;
	for(int i = 0; i < EXPLOSION_MAX_COUNT;i++)
	{
		mSmokes[i].Initialize();
	}
}

void ExplosionsManager::Update(int pElapsedTime)
{
	for(int i = 0; i < EXPLOSION_MAX_COUNT;i++)
	{
		mSmokes[i].Update(pElapsedTime);
	}
}

void ExplosionsManager::StartExplosion(XMFLOAT3 pPosition, XMFLOAT3 pNormal)
{
	mSmokes[mNextIndexExplosion].StartExplosion(pPosition, pNormal);
	mNextIndexExplosion++;
	if(mNextIndexExplosion > EXPLOSION_MAX_COUNT - 1) mNextIndexExplosion = 0;
}

void ExplosionsManager::Render()
{
	for(int i = 0; i < EXPLOSION_MAX_COUNT;i++)
	{
		mSmokes[i].Render();
	}
}
